PPOL 6805 / DSAN 6750: GIS for Spatial Data Science
Fall 2024
Wednesday, September 11, 2024
From the sf Cheatsheet
sf and terra.shp et al.)A shape“file” is actually (at least) three separate files bundled together:
.shp: Containing feature geometries.shx: Positional indices.dbf: Data attributes.prj: Coordinate reference system.xml: MetadataLet’s see what’s inside the shapefile we first saw in Week 1, containing data on DC’s Census Tracts: Census Tracts in 2020
DC Census Tracts (with the Georgetown campus tract highlighted!) from OpenData.DC.gov
From Rodrigue (2016)
.geojson).csvmy_data.geojson
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[30, 20], [45, 40],
[10, 40], [30, 20]
]
]
},
"properties": {
"color": "green",
"area": 3565747
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[15, 5], [40, 10],
[10, 20], [5, 10],
[15, 5]
]
]
},
"properties": {
"color": "red",
"area": 3272386
}
}
]
}.gpkg).tif).nc4)EPSG (European Petroleum Survey Group) Registry: Most common way to specify a CRS
PROJ: Rather than opaque numeric code like EPSG, uses plaintext “proj-strings” containing parameter info: datum, ellipsoid, projection, and units (e.g. meters). Example: PROJ4 code EPSG:4326 is represented as
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defsHere we’ll look at Africa:
Using rnaturalearth with mapview
Computing the union of all geometries in the sf via sf::st_union()
Use st_union() first:
Computing the centroid of all geometries in the sf via sf::st_centroid()
[,1]
[1,] "FF2F1F212"
Sparse geometry binary predicate list of length 1, where the predicate
was `covers'
1: (empty)
Sparse geometry binary predicate list of length 1, where the predicate
was `covered_by'
1: (empty)
PPOL 6805 Week 3: Geospatial Operations